-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api-minor] Add offsetX and offsetY to PDFPageProxy.getViewport #10368
Conversation
@gpbmike The pull request above did some refactoring of the method signature to make it easier to extend. Could you update this pull request to match that? You would need to extend https://github.com/mozilla/pdf.js/pull/10369/files#diff-0ecad279ed2252e3eb47a4d96ec1463cR765 for the documentation (with the properties in the same order as in the method signature) and https://github.com/mozilla/pdf.js/pull/10369/files#diff-0ecad279ed2252e3eb47a4d96ec1463cR918 for the method signature, indented like this:
|
Also, any new API functionality needs to add at least a (basic) unit-test as well, this is even more relevant when it's functionality used nowhere in the code-base. Edit: The new unit-test would look similar to e.g. this existing one: Lines 1063 to 1075 in 78eb730
|
For inspiration regarding the above, we have such unit tests in https://github.com/mozilla/pdf.js/blob/master/test/unit/custom_spec.js for custom functionality. |
@gpbmike Do you have time to fix this up so we can try to get this merged? |
@timvandermeij I don't have time at the moment. At this point it would be easier to open a new PR. |
That's OK. If you decide to open a new pull request, you can use the refactoring done in the other PR and the comments above to bring it in a mergeable state. Thanks. |
Objective
Render partial PDF to canvas at a very high scale (100+).
Problem
The canvas has a maximum pixel area. Rendering the full canvas has an upper scale limit before the browser will block it.
Solution
Render part of the canvas without rendering the full canvas.
Current Workaround
This PR would allow access to setting
offsetX
andoffsetY
.An alternative would be exporting
PageViewport
.Example
left: 2160 x 3024 pixel at scale 1 (scaled down to see entire pdf here)
right: 500 x 500 zoomed canvas at scale 50